﻿using System;
using System.Threading;

namespace Listing1_1
{
    public static class Program
    {
        public static void ThreadMethod()
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("ThreadProc: {0}", i);
                Thread.Sleep(0);
            }
        }
        public static void Main()
        {
            var t = new Thread(new ThreadStart(ThreadMethod));
            t.Start();
            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("Main thread: Do some work.");
                Thread.Sleep(0);
            }
            t.Join();
            Console.ReadKey();
        }
    }
}
//// Displays
////Main thread: Do some work.
////ThreadProc: 0
////Main thread: Do some work.
////ThreadProc: 1
////Main thread: Do some work.
////ThreadProc: 2
////Main thread: Do some work.
////ThreadProc: 3
////ThreadProc: 4
////ThreadProc: 5
////ThreadProc: 6
////ThreadProc: 7
////ThreadProc: 8
////ThreadProc: 9
////ThreadProc: 10
